package com.spic.system.api.factory;

import com.spic.common.core.domain.R;
import com.spic.system.api.RemoteJobService;
import com.spic.system.api.domain.SysJobDto;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 定时任务
 */
@Component
public class RemoteJobFallBackFactory implements FallbackFactory<RemoteJobService> {
    @Override
    public RemoteJobService create(Throwable cause) {
        return new RemoteJobService() {
            @Override
            public R<String> addSysJob(SysJobDto sysJobDto,String source) {
                return R.fail("定时任务失败:" + cause.getMessage());
            }

            @Override
            public R<Object> removeSysJob(Long[] jobIds, String source) {
                return R.fail("定时任务失败:" + cause.getMessage());
            }
        };
    }
}
